<?php

declare(strict_types=1);

namespace App\Service\Business;

/**
 * 枚举-业务类
 */
class EnumBusiness extends BaseBusiness
{
        /**
         * 查询
         * @return array
         */
        public function query(): array
        {
                $arrModules = $this->request->input('modules', []);
                $arrResult = [];
                foreach ($arrModules as $v) {
                        switch ($v) {
                                case 'menu':
                                        $arrResult['menu'] = [
                                                'belongTo' => constantsEnumToIndexArray(\App\Constants\Menu\MenuBelongToEnum::cases()),
                                                'method' => constantsEnumToIndexArray(\App\Constants\Menu\MenuMethodEnum::cases()),
                                                'status' => constantsEnumToIndexArray(\App\Constants\Menu\MenuStatusEnum::cases()),
                                                'type' => constantsEnumToIndexArray(\App\Constants\Menu\MenuTypeEnum::cases()),
                                                'isHide' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsHideEnum::cases()),
                                                'isHideTab' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsHideTabEnum::cases()),
                                                'isKeepAlive' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsKeepAliveEnum::cases()),
                                                'isFixedTab' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsFixedTabEnum::cases()),
                                                'isIframe' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsIframeEnum::cases()),
                                                'isFullPage' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsFullPageEnum::cases()),
                                                'isBadge' => constantsEnumToIndexArray(\App\Constants\Menu\MenuIsBadgeEnum::cases()),
                                        ];
                                        break;
                                case 'role':
                                        $arrResult['role'] = [
                                                'status' => constantsEnumToIndexArray(\App\Constants\Role\RoleStatusEnum::cases()),
                                        ];
                                        break;
                                case 'user':
                                        $arrResult['user'] = [
                                                'status' => constantsEnumToIndexArray(\App\Constants\User\UserStatusEnum::cases()),
                                        ];
                                        break;
                                case 'customModuleField':
                                        $arrResult['customModuleField'] = [
                                                'type' => constantsEnumToIndexArray(\App\Constants\CustomModuleField\CustomModuleFieldTypeEnum::cases()),
                                        ];
                                        break;
                                case 'customModuleData':
                                        $arrResult['customModuleData'] = [
                                                'status' => constantsEnumToIndexArray(\App\Constants\CustomModuleData\CustomModuleDataStatusEnum::cases()),
                                        ];
                                        break;
                        }
                }
                return businessSuccess($arrResult);
        }
}